"""
    cookie是用于标识用户的身份信息的一段数据
        cookie由服务器返回（seession_id)
"""

import requests

url = "https://fanyi.baidu.com/basetrans"

# 设置请求头参数
headers = {
    'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/130.0.0.0',
    'Cookie': 'BAIDUID_BFESS=FBD86CD1E111A5292FAA4776BB6376A1:FG=1; __bid_n=192aa646c229888c769d67; BDUSS=nJqdFBGenlDY01DV0tDY0hOdUJjMXNNdG5vREJad05QeHJyZmlpNU5sflpVa1JuSUFBQUFBJCQAAAAAAAAAAAEAAAAgWWU10tHKxbXEx-C0ujIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANnFHGfZxRxnT; BDUSS_BFESS=nJqdFBGenlDY01DV0tDY0hOdUJjMXNNdG5vREJad05QeHJyZmlpNU5sflpVa1JuSUFBQUFBJCQAAAAAAAAAAAEAAAAgWWU10tHKxbXEx-C0ujIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANnFHGfZxRxnT; newlogin=1; BIDUPSID=FBD86CD1E111A5292FAA4776BB6376A1; PSTM=1733191250; H_PS_PSSID=61027_61096_61176_61223_61206_61211_61208_61215_61244_61279_61300; BA_HECTOR=800080050k8k20a42g252gagbpssp31jkspij1u; ZFY=blLmk0GHMgK6dcXIcpNezAs9lvJzhN8MGks:Alowys7I:C; BAIDUID=5845E8EB99B0B3C3F38B55FD8CBD21CE:FG=1; RT="z=1&dm=baidu.com&si=544d931f-ac53-4bac-b6ed-08bc5b24cea4&ss=m47tjytv&sl=1&tt=2ly&bcn=https%3A%2F%2Ffclog.baidu.com%2Flog%2Fweirwood%3Ftype%3Dperf&r=wjuw2v0&ul=4ve&hd=54t"; Hm_lvt_afd111fa62852d1f37001d1f980b6800=1733191719; Hm_lvt_64ecd82404c51e03dc91cb9e8c025574=1733191719; Hm_lpvt_afd111fa62852d1f37001d1f980b6800=1733191790; Hm_lpvt_64ecd82404c51e03dc91cb9e8c025574=1733191790; ab_sr=1.0.1_NjQxM2RhOTY5YWZlNzk1ZmY4ZWIyZTg2N2UzYWI1NDY3ZDJhM2MzZTZlMTg4ZDY4NTc1ZWZiNTE5NDA5NGE0OGYwMWYzOTU2YTBkMDUxNDU3ZmVmNzExOTgzNDQ3MmE0OWZiODNhNDM1NWQzNTZhMjk1YzEwMzFhMDE4YTkwZmNhY2ZjMjg3Y2ZhZWQzOTVmZDE4NmY1MWI5YmQ0MDYzZGUyNDNjYmJhMTA0OWE2M2I1NWNmOTgyMDQ4OT'
}
data_params = {
    # 对于翻译的单词不能更改，有一个sign加密对应
    'query': 'login',
    'from': 'en',
    'to': 'zh',
    'token': '2869a367ffd61b3d1f54f3084cff7479',
    'sign': 321549.2876
}
response = requests.post(url, headers=headers, data=data_params).json()

print(response)

